﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using QxFramework.Core;
using UnityEngine.UI;
using App.Common;
using ButtonEvent = UnityEngine.Events.UnityAction;
using System;
using QxFramework.Utilities;
using DG.Tweening;

public class BlackMask : UIBase
{
    public override void OnDisplay(object args)
    {
        base.OnDisplay(args);
        CollectObject();
        GetComponent<Image>().color = new Color(0, 0, 0, 0);
        _arg = args as BlackMaskArg;
        Init();
    }
    void Init()
    {
        GetComponent<Image>().DOColor(new Color(0, 0, 0, 1),0.5f).OnComplete(()=> {
            _arg._action();
        });
    }
    public void CloseUI()
    {
        GetComponent<Image>().DOColor(new Color(0, 0, 0, 0), 0.5f);
        UIManager.Instance.Close(this);
    }

    private BlackMaskArg _arg;
    public class BlackMaskArg
    {
        public Action _action;
        public BlackMaskArg(Action action = null)
        {
            _action = action;
        }
    }
}
